import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Project : SRCS-TME2
 * Date : 2 mars 2011
 * Author : Yoann
 */
/**
 * @author Yoann
 *
 */
public class Serveur {

	static final int MINIDLE = 1;
	static final int MAXIDLE = 2;
	static final int N = 3;
	public static void main(String[] args) {
		try {
			System.out.println("Start server");
			ServerSocket server = new ServerSocket(12345);
			
			Supervisor supervisor = new Supervisor(MINIDLE,MAXIDLE,N);
			supervisor.start();
			
			while(true){
				System.out.println("Wait client");
				Socket client = server.accept();
				System.out.println("Client accepted");
				supervisor.put(new Job(client));
			}
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
